import 'dart:convert';
import 'package:meta/meta.dart';

class MessionDetail {
  final int id;
  final String m_name;
  final int m_type;
  final String m_type_name;
  final String m_slogen;
  final String m_icon;
  final int m_point;
  final String m_detail;
  final String m_out_url;
  final String m_out_id;
  final String m_package_name;
  final String m_app_mall;
  final String m_mall_icon;
  final DateTime m_start_time;
  final DateTime m_end_time;

  MessionDetail({
    @required this.id,
    @required this.m_name,
    @required this.m_type,
    @required this.m_type_name,
    @required this.m_slogen,
    @required this.m_icon,
    @required this.m_point,
    @required this.m_detail,
    @required this.m_out_url,
    @required this.m_out_id,
    @required this.m_package_name,
    @required this.m_app_mall,
    @required this.m_mall_icon,
    @required this.m_start_time,
    @required this.m_end_time,
  });

  static MessionDetail fromJson(String json) {
    MessionDetail _mession;
    JsonDecoder decoder = new JsonDecoder();
    var mapData = decoder.convert(json)['data'];
    _mession = new MessionDetail(
      id: mapData['id'],
      m_name: mapData['m_name'],
      m_type: mapData['m_type'],
      m_type_name: mapData['m_type_name'],
      m_slogen: mapData['m_slogen'],
      m_icon: mapData['m_icon'],
      m_point: mapData['m_point'],
      m_detail: mapData['m_detail'],
      m_out_url: mapData['m_out_url'],
      m_out_id: mapData['m_out_id'],
      m_package_name: mapData['m_package_name'],
      m_app_mall: mapData['m_app_mall'],
      m_mall_icon: mapData['m_mall_icon'],
      m_start_time: mapData['m_start_time'],
      m_end_time: mapData['m_end_time'],
    );
    return _mession;
  }
//  factory Mession.fromJson(Map<String, dynamic> json) {
//    return Mession(
//      m_name: json['m_name'],
//      m_type: json['m_type'],
//      m_type_name: json['m_type_name'],
//      m_slogen: json['m_slogen'],
//      m_icon: json['m_icon'],
//      m_point: json['m_point'],
//    );
//  }
}
